<!DOCTYPE html>
<html>
<head>
<head>
<meta charset="UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<title>c.html</title>
<link href="../../css/main.css" rel="stylesheet">
</head>
<body>
	<h1 id="href"></h1>
	<div id="status">状态信息</div>
	<div id="wsMsg">消息日志</div>
</body>
</html>
<script src="../../js/jquery.3.2.1.min.js"></script>
<script src="../../js/WebSocket.js"></script>
<script>
	$('#href').html(location.href);
	var cid = `c`;
	var wsUrl = `ws://localhost:8081/websocket/${cid}`;
	// 建立WebSocket连接
	createWebSocket(wsUrl);
	// 由各个子系统重写onmessage()方法
	function onmessageHandler(data) {
		try {
			var json = JSON.parse(data);
			if (json) {
				if (json.message) {
					alert(json.message);
				}
			} else {
				alert('消息格式不是JOSN');
			}
		} catch (err) {
			alert(data);
			console.log(err.message);
		}
	}
</script>